import pandas as pd
import numpy as np

stock_change = np.random.normal(0, 1, (10, 5))
# stock_rise = pd.DataFrame(stock_change)
stock_code = ['股票' + str(i + 1) for i in range(stock_change.shape[0])]
date = pd.date_range('2024-01-01', periods=stock_change.shape[1], freq='B')

stock_rise = pd.DataFrame(stock_change, index=stock_code, columns=date)
# stock_rise.reset_index()
# print(stock_rise.shape)
# print(stock_rise.index)
# print(stock_rise.columns)
# print(stock_rise.values)
# print(stock_rise.reset_index())
# print(stock_rise.set_index(['2024-01-01']))
# print(stock_rise)
# print(stock_rise.drop(['2024-01-05'], axis=1))

# [[]]获得DataFrame，[]获得Series
print(stock_rise[['2024-01-01']])
print(stock_rise[['2024-01-01']].apply(lambda x: x.max()-x.min(), axis=0))
